package com.airlines.crewassignment.service.basicinfo.impl;

import com.airlines.common.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.airlines.crewassignment.service.basicinfo.BackupTypeService;
import com.airlines.crewassignment.entity.basicinfo.BackupType;
import java.util.List;
import com.airlines.crewassignment.dao.basicinfo.BackupTypeMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * @author xxxx
 * @date 2018/06/08 09:03:38
 * @company xxxx Airlines
 * @description 
 */
@Service
public class BackupTypeServiceImpl implements BackupTypeService {

    @Autowired
    private BackupTypeMapper backupTypeMapper;

    @Override
    public int insert(BackupType backupType){
        return backupTypeMapper.insert(backupType);
    }

    @Override
    public int deleteLogic(Integer bakType){
        return backupTypeMapper.deleteLogic(bakType);
    }


    @Override
    public int update(BackupType backupType){
        return backupTypeMapper.update(backupType);
    }

    @Override
    public BackupType get(Integer bakType){
        return backupTypeMapper.get(bakType);
    }

    @Override
    public List<BackupType> list(BackupType backupType){
        return backupTypeMapper.list(backupType);
    }

    @Override
    public Page list(BackupType backupType, Page page){
        PageHelper.startPage(page.getPageNumber(), page.getPageSize());
        List<BackupType> list = backupTypeMapper.listByFuzzy(backupType);
        PageInfo<BackupType> pageInfo = new PageInfo<BackupType>(list);
        page.setTotal(String.valueOf(pageInfo.getTotal()));
        page.setRows(pageInfo.getList());
        return page;
    }




}
